clear all;close all;clc

load pc_all_EEGgamma_withCM %EEG
ALL_PC3(:,1)=PC_all';
for isubject=1:16
    EEG_CI(isubject) = f_confid_I(20*20*5,PC_all(isubject),0.05); 
end

load EMG_PC_resultall  %EMG
ALL_PC3(:,2)=PCall'./100;
for isubject=1:16
    EMG_CI(isubject) = f_confid_I(20*20*5,PCall(isubject)./100,0.05); 
end

load pc_EEGEMGcombined_15layers % combined
ALL_PC3(:,3)=PC_all';
for isubject=1:16
    Com_CI(isubject) = f_confid_I(20*20*5,PC_all(isubject),0.05); 
end



f1=figure('position',[100 100 900 300]);
bar((1:16)-0.2,ALL_PC3(:,1).*100,0.2)
hold on;
bar((1:16),ALL_PC3(:,2).*100,0.2)
bar((1:16)+0.2,ALL_PC3(:,3).*100,0.2)
errorbar((1:16)-0.2,ALL_PC3(:,1).*100,EEG_CI.*100,'.k')
errorbar((1:16),ALL_PC3(:,2).*100,EMG_CI.*100,'.k')
errorbar((1:16)+0.2,ALL_PC3(:,3).*100,Com_CI.*100,'.k')
plot([0 17],[20 20],'k');
set(gca,'xtick',1:16)
box off;
ylim([0 100])
legend('EEG-Gamma','EMG','Combined','Location','NorthEastOutside'); legend boxoff
xlabel('Subject');
ylabel('Accuracy (%)');
exportgraphics(f1,'Figure12_combined.png','Resolution',300);